<!DOCTYPE HTML>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>商之联后台管理系统</title>
  <meta name="description" content="这是一个 table 页面">
  <meta name="keywords" content="table">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="{:C('SUPPLIER_ADMIN_IMG')}favicon.png"> <link rel="apple-touch-icon-precomposed" href="{:C('SUPPLIER_ADMIN_IMG')}app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="{:C('SUPPLIER_ADMIN_CSS')}amazeui.min.css"/>
  <link rel="stylesheet" href="{:C('ADMIN_CSS')}admin.css">
  
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->
<!-- header start-->

<include file="Public:header"/>

<!-- header end-->
<div class="am-cf admin-main">
 <!-- sidebar start -->
   <include file="Public:menu"/>
  <!-- sidebar end -->

  <!-- content start -->
  <div class="admin-content">

    <div class="am-cf am-padding">
      <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">商品管理</strong> / <small>商品列表</small></div>
    </div>
    <div class="am-g">
      <div class="am-u-sm-12 am-u-md-1">
        <div class="am-btn-toolbar">
          <div class="am-btn-group am-btn-group-xs">
            <button type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> <a href="{:U('Item/addItem')}">新增商品</a></button>
          </div>
        </div>
      </div>

      <div class="am-u-sm-12 am-u-md-8">
        <div class="am-btn-toolbar">
          <div class="am-btn-group am-btn-group-xs">
          <!--顶级类目-->
            <span >
              <select  id="leim" onchange="javascript:types();">
              <option value=0>顶级类目</option>
              <foreach name="toptype" item="type" key='key'>
              <option value="{$key}">{$type}</option>
              </foreach>
              </select>
            </span>
              <!--二级类目-->
            <span class='typetree' >
              <select name='typeid' id="setype" onchange="javascript:brand();">
              <option value=0>二级类目</option>
              </select>
            </span>
            <!--品牌-->
            <span class='brandtree'>
              <select name='brandid' id="brand">
              <option value=0>全部品牌</option>
               <!-- <foreach name="brands" item="brand" key="key">
                 <option value={$key}  <if condition="$Think.cookie.brandid eq $key ">selected</if> >{$brand}</option>
                             </foreach> -->
              </select>
            </span>
            <span><button type="button" class="am-btn am-btn-primary am-btn-xs" id="filter">筛选</button></span>
          </div>
        </div>
      </div>

      
      <div class="am-u-sm-12 am-u-md-3">
        <div class="am-input-group am-input-group-sm">
          <input type="text" class="am-form-field" name="keywords" value="{$Think.cookie.keywords}">
          <span class="am-input-group-btn">
            <button class="am-btn am-btn-secondary keyseach" type="button">搜索</button>
          </span>
        </div>
      </div>
    </div>



    <div class="am-g">
      <div class="am-u-sm-12">

          <table class="am-table am-table-striped am-table-hover table-main">
            <thead>
              <tr>
                <th class="table-check"><input type="checkbox" /></th>
                <th class="table-id">ID</th>
                <th class="table-title">商品名称</th>
                <th class="table-title">规格型号</th>
                <th class="table-title">零售价</th>
                <th class="table-title">供货价</th>
                <th class="table-title">库存</th>
                <th class="table-date">生成日期</th>
                <th class="table-title">上架</th>
                <th class="table-set">操作</th>
              </tr>
          </thead>
          <tbody>
            <foreach name="items" item='item'>
            <tr class="item_{$item['itemid']}">
              <td><input type="checkbox" /></td>
              <td>{$item['itemid']}</td>
              <td>{$item['itemname']}</td>
              <td>{$item['bn']}</td>
              <td ><span class="itemprice" value='price' id="{$item['itemid']}"> {$item['price']}</span> </td>
              <td><span class="supprice" value='supprice' id="{$item['itemid']}" >  {$item['supperprice']} </span> </td>
              <td>  <span class="inventory" value='inventory' id="{$item['itemid']}" > {$item['inventory']}</span> </td>
              
              <td>{$item.createtime}</td>
              <td> <a  href="javascript:void(0)" value={$item['itemid']} class="itemstatus"> 
              <if condition="$item['status'] eq '2' ">
                <span class='am-icon-arrow-down'></span>
              <else/>
                <span class='am-icon-arrow-up'></span> 
              </if>
              </a> 
              </td>
              <td>
                <div class="am-btn-toolbar">
                  <div class="am-btn-group am-btn-group-xs">
                    <span class="am-icon-pencil-square-o"></span><a href="{:U('item/editItem',array('itemid'=>$item['itemid']))}">编辑</a> 
                    <span class="am-icon-trash-o"></span><a href="javascript:void(0)" class="delitem"  value={$item['itemid']}> 删除 </a>
                     <span class="am-icon-eye"></span><a href="{:U('item/viewItem',array('itemid'=>$item['itemid']))}"target="_blank">预览</a>
                     <if condition=" $item['examine'] eq 0 ">
                          &nbsp;<span class=am-icon-bell-o></span><a href="javascript:void(0)" class="examineitem" value="{$item['itemid']}"> 未审核 </a>
                     </if>
                     <if condition="$item['examine'] eq 1 ">
                          &nbsp;<span class=am-icon-bell-o></span><a href="javascript:void(0)" class="" > 已审核 </a>
                     </if>
                  </div>
                </div>
              </td>
            </tr>
            </foreach>
          </tbody>
        </table>
      
        <div class="am-fr page">
    <ul class="am-pagination" >
      <li>共<label class="count"> {$pagearr['count']}</label> 条记录</li>
      <li>共<label class="pagetotal" > {$pagearr['pagetotal']}</label> 页</li>
     
       <li><label>&nbsp;跳转至&nbsp;</label><input type="text" size="2" id="page"  onchange="javascript:setPage();">页</li>
      <li>当前第 <label class="currentpage"> {$pagearr['page']} </label> 页</li>
      <li><a href="javascript:pageajax('firpage')" class="firpage" value="1" >第一页</a></li>
      <li><a href="javascript:pageajax('prepage')" class="prepage" value={$pagearr['page']-1}>上一页</a></li>
      <li><a href="javascript:pageajax('nexpage')" class="nexpage" value={$pagearr['page']+1}>下一页</a></li>
      <li><a href="javascript:pageajax('laspage')" class="laspage" value={$pagearr['pagetotal']}>最末页</a></li>
    </ul>
  </div>

</div>

      </div>

    </div>
  </div>
  <!-- content end -->
</div>


<script src="{:C('ADMIN_JS')}jquery.min.js"></script>
<include file="Public:footer"/>

<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="{:C('SUPPLIER_ADMIN_JS')}polyfill/rem.min.js"></script>
<script src="{:C('SUPPLIER_ADMIN_JS')}polyfill/respond.min.js"></script>
<script src="{:C('SUPPLIER_ADMIN_JS')}amazeui.legacy.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="{:C('SUPPLIER_ADMIN_JS')}amazeui.min.js"></script>
<!--<![endif]-->
<script src="{:C('SUPPLIER_ADMIN_JS')}app.js"></script>
<script src="{:C('SUPPLIER_ADMIN_JS')}jquery.cookie.js"></script>
<script src="{:C('ADMIN_JS')}admin.js"></script>
<script type="text/javascript">
function setPage(){
  var page=$("#page").val();
 
     var keywords=$("input[name='keywords']").val();
     $.searchitem(page,keywords);
     return false;


}
  




  //翻页事件
  function pageajax(name){
     var pagevalue=$('.'+name).attr('value');
     var keywords=$("input[name='keywords']").val();
     $.searchitem(pagevalue,keywords);
     return false;
  }

</script>

<script type="text/javascript">
//获取二级类目
  function types(){
    var top=$('#leim').val();
    jQuery.get('{:U("Item/stype")}',
      {typeid:top,},
      function(data){
        $('#setype option').remove("option[value !=0]");
 $('#setype').append(data); 

      },'text');
  }

  //获取对应的品牌
  function brand(){
    var brand=$('#setype').val();
      jQuery.get('{:U("Item/brand")}',
        {brandid:brand,},
        function(data){
           $('#brand option').remove("option[value !=0]");
          $('#brand').append(data); 
        },'text');
  }
</script>
</body>
</html>
